<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use app\common\library\Token;

class Index extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function _initialize()
    {
        parent::_initialize();
    }

    public function index()
    {    
        
        $slideList = db('slide')->where('imagetype', 'index')->select();
        $this->view->assign('slideList', $slideList);
        //dump($slideList);exit;
        $notice_title = db('config')->where('name','notice_title')->column('value');
        $notice_title = isset($notice_title[0]) ? $notice_title[0] : 'test';
        $this->view->assign('notice_title', $notice_title);
        //$site = config("site"); //可以用,下次用
        //dump($site);exit;
        
         $market_price = db('config')->where('name','market_price')->column('value');

         $this->view->assign('market_price', $market_price[0]);
        
        //查询咨询
        $map = [
                'category_id'       => 12,
                'status' => 0,
            ];
        $art_list = db('article')->where($map)->field('id, name')->order('weigh','desc')->select();
        $this->view->assign('art_list', $art_list); 

        $total_zc = $this->auth->money+$this->auth->score;
        $this->view->assign('total_zc', $total_zc); 
        
        return $this->view->fetch();
    }

    public function news()
    {
        $newslist = [];
        return jsonp(['newslist' => $newslist, 'new' => count($newslist), 'url' => 'https://www.fastadmin.net?ref=news']);
    }

   //公告页面
   public function notice(){

     $site = config("site"); 
     //dump($site['notice']);exit;
     $this->view->assign('notice',$site['notice']); 
     return $this->view->fetch();

   }




}
